import java.util.Random;
import java.util.Scanner;

/**
 * @author 8zhazha8
 * @create 2021-04-24-20:54
 */
public class HomeWork5 {
    public static void main(String[] args) {
        Random random =new Random();
        int []n=new int[10];
        for (int i = 0; i < n.length; i++) {
            n[i]=random.nextInt(11);
            System.out.print(n[i]+"\t");
        }
        System.out.println();
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入要查找的数字");
        int m=scanner.nextInt();
        int chishu=chishu(n,m);
        if (m>=0 && m<=10) {
            if (chishu==0) {
                System.out.println("没有你要查找的数字");
            }
            else {
                System.out.println("你要查找的数字有："+chishu+"个");
            }
        }
        else {
            System.out.println("请输入一个在范围内的数字");
        }
    }

    public static int chishu(int n[], int m) {
        int sum=0;
        for (int i = 0; i < n.length; i++) {
            if (n[i]==m) {
                sum=sum+1;
            }
        }
        return sum;
    }
}
